{% extends 'base.html' %}

{% block head %}
	<link href="{{ path }}css/components/signin.css" rel="stylesheet" type="text/css">   
	<script src="{{ path }}js/demos/signin.js"></script>
    
    <link href="{{ path }}js/plugins/datatables/DT_bootstrap.css" rel="stylesheet">
	<link href="{{ path }}js/plugins/responsive-tables/responsive-tables.css" rel="stylesheet"> 
    
    <script src="{{ path }}js/demos/demo.tables.js"></script>
    <script src="{{ path }}js/plugins/datatables/jquery.dataTables.js"></script>
    <script src="{{ path }}js/plugins/datatables/DT_bootstrap.js"></script>
	<script src="{{ path }}js/plugins/responsive-tables/responsive-tables.js"></script>
    
    

	
	<script src="{{ path }}js/plugins/excanvas/excanvas.min.js"></script>
{% endblock %}
{% block javascript %}
function OnSubmitForm(){
	if(document.pressed == 'Ingresar'){
		document.login.action ="/login/";
	}
    
	return true;
}

{% endblock %}


{% block jquery %}
{% endblock %}


{% block contenido %}
<!--
	{{ texto }}
    -->
    
    <div class="span12">
        <div class="widget">
            
            <div class="widget-header">
                <h3>
                    <i class="icon-magic"></i>
                    Productos próximos a vencer
                </h3>
            </div> <!-- /widget-header -->
            <div class="widget-content">
            	<table class="table table-striped table-bordered table-highlight" id="example">
                    <thead>
                    <tr>
                        <th width="10%" align="center">Código o Cum</th>
                        <th width="35%" align="center">Nombre</th>
                        <th width="10%" align="center">Lote</th>
						<th width="10%" align="center">Factura</th>
                        <th width="15%" align="center">Sede</th>
                        <th width="5%" align="center">Unidades</th>
                        <th width="15%" align="center">Vence en</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for inv in Inventario %}
                        <tr class="{% cycle '' 'odd' %}">
                            <td align="right"><label>{{ inv.item.producto.cum }}</label></td>
                            <td align="left"><label>{{ inv.item.producto.nombre }}</label></td>
                            <td align="center"><label>{{ inv.item.lote }}</label></td>
							<td align="left"><label>{{ inv.item.factura_compra.numero|default_if_none:"" }}</label></td>
                            <td align="center"><label>{{ inv.sede.nombre }}</label></td>
                            <td align="center"><label>{{ inv.cantidad }}</label></td>
							<td align="center"><label>{{ inv.item.fecha_vencimiento|timeuntil }}</label></td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div> <!-- /widget-content -->
			<div class="modal-footer">
				<!--<button type="submit" id="btn_eliminar" class="btn btn-medium">Eliminar</button>-->
				<a href="#myModal" id="btn-nuevo" data-toggle="modal" class="btn btn-primary btn-medium">Notificaciones vía Email</a>
			</div>
        </div> <!-- /widget -->	
	</div> <!-- /span6 -->	
    
	<div class="modal fade hide" id="myModal">
		<form id="form-notificacion" class="form-horizontal" action="/configuracion/notificacion/guardar/" method="post" enctype="multipart/form-data">
			  {% csrf_token %}
			  <div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">&times;</button>
					<h3>Correos para notificación</h3>
			  </div>
			  <div class="modal-body" id="nuevo-producto">
					<div class="control-group">
						<label class="control-label" for="bizname">Email:</label>
						<div class="controls">
							<textarea id="correo" name="correo" class="input-large" rows="4">{{ Notificaciones.correo|default_if_none:"" }}</textarea>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="bizname">Nota:</label>
						<div class="controls">
							<label class="input-large" >Para ingresar más de un Email, separar con una coma.</label>
						</div>
					</div>
			  </div>
			  <div class="modal-footer">
				<a href="#" class="btn btn-medium" data-dismiss="modal">Cerrar</a>
				<button type="submit" id="btn_guardar" class="btn btn-primary btn-medium">Guardar</button>
			  </div>
		</form>
	</div>
{% endblock %}


{% block contenido2 %}
<div class="account-container login">
    <div class="content clearfix">
    <form id="login" name="login" onSubmit="return OnSubmitForm();" method="post">
        {% csrf_token %}
        <div class="login-fields">
            <h1>Iniciar Sesión</h1>			
            <p>Iniciar sesión con su cuenta registrada:</p>
            
            <div class="field">
                <label for="username">Usuario:</label>
                <input type="text" id="usuario" name="usuario" value="" placeholder="Username" class="login username-field" />
            </div> <!-- /field -->
            
            <div class="field">
                <label for="password">Contraseña:</label>
                <input type="password" id="contrasena" name="contrasena" value="" placeholder="Password" class="login password-field"/>
            </div> <!-- /password -->
            
        </div> <!-- /login-fields -->
        {% if msg_error %}
            <div class="alert alert-error">
                <h4 class="alert-heading">{{ msg_error }}</h4>
            </div>
		{% endif %}
        <div class="login-actions">
            <span class="login-checkbox">Recordar <a href="#mdl_recordar" data-toggle="modal" id="recordar">contraseña</a></span>
            <button type="submit" class="button btn btn-secondary btn-large" id="ingresar" value="Ingresar" onclick="document.pressed=this.value">Ingresar</button>
        </div> <!-- .actions -->
	</form>
	</div>
</div>

<div class="modal fade hide" id="mdl_recordar">
    <form id="form-facultades" class="form-horizontal" action="/configuracion/recuperar/" method="post">
          <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h3>Recordar contraseña</h3>
          </div>
          <div class="modal-body">
          		<label style="text-align:center" for="input01">El sistema generará una nueva contraseña y la enviará a su correo electrónico.<br/></label>
                {% csrf_token %}
                <fieldset>
	                <div class="control-group">
                        <label class="control-label" for="input01">Ingrese el nombre de usuario:</label>
                        <div class="controls">
                            <input type="text" class="input-large" name="email" id="email" required="required" value=""/>
                        </div>
                    </div>
                </fieldset>
          </div>
          <div class="modal-footer">
            <button type="submit" class="btn btn-primary btn-medium">Recordar</button>
            <a href="#" class="btn btn-primary btn-medium" data-dismiss="modal">Cerrar</a>
          </div>
    </form>
</div>

{% endblock %}